import moment from 'moment'

var app = {

  before: function (date, before, callback) { //获取当前时间的前 N个小时
    var result = moment(date).add(before, 'hour').format('YYYY-MM-DD HH:mm:ss')
    return callback(result)
  },

  ticketDate : function (date, num , callback) { //阿里云票务查询时间格式化
    if(num === 0)//开始时间
      date = date +' 00:00:00'
    if(num === 1)//结束时间
      date = date +' 23:59:59'
    var result = moment(date).add(-13, 'hour').format('YYYY-MM-DD HH:mm:ss')
    return callback(result)
  }
}


export default app;
